#!/usr/bin/python
# -*- coding: UTF-8 -*-

import tornado.httpserver as _http
import tornado.ioloop as _loop
import tornado.web as _web
import tornado.options as _opts
from tornado.options import define as _def

from hello import Hello
from user import User

_def("port", default=8080, type=int, help="visit port!")
_def("info", default="", type=str, help="print info!")

if __name__ == "__main__":
    _opts.parse_config_file("./conf")
    opts = _opts.options
    print("***", opts.info)
    app = _web.Application([
        (r"/hello", Hello),
        (r"/user", User)
    ])
    server = _http.HTTPServer(app)
    server.listen(opts.port)
    _loop.IOLoop.current().start()
